// SettingTowerLamp.cpp : implementation file
//

#include "stdafx.h"
#include "DSTapeMount.h"
#include "SettingTowerLamp.h"

// Common Layer
#include "Util/MinUtilExt.h"
#include "Util/MyMsgWnd.h"
#include "DataManager/CDMControlCenter.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CSettingTowerLamp dialog


CSettingTowerLamp::CSettingTowerLamp(CDMControlCenter* pDMCC,CWnd* pParent /*=NULL*/)
	: CDialog(CSettingTowerLamp::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSettingTowerLamp)
	//}}AFX_DATA_INIT
	assert(pDMCC != NULL);
	m_lnkTowerLampData = pDMCC->GetTowerLampDataCOM();
	StartInitFlag = FALSE;
}


void CSettingTowerLamp::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSettingTowerLamp)
	DDX_Control(pDX, IDB_YEL, m_bYel);
	DDX_Control(pDX, IDB_SAVE, m_bSave);
	DDX_Control(pDX, IDB_RUN_YEL, m_bRunYel);
	DDX_Control(pDX, IDB_RUN_RED, m_bRunRed);
	DDX_Control(pDX, IDB_RUN_OK_BZ, m_bRunOkBz);
	DDX_Control(pDX, IDB_RUN_LP_BLINK, m_bRunLampBlink);
	DDX_Control(pDX, IDB_RUN_GNE, m_bRunGen);
	DDX_Control(pDX, IDB_RUN_ER_BZ, m_bRunErrorBz);
	DDX_Control(pDX, IDB_RUN, m_bRun);
	DDX_Control(pDX, IDB_RED, m_bRed);
	DDX_Control(pDX, IDB_MANUAL_YEL, m_bManualYel);
	DDX_Control(pDX, IDB_MANUAL_RED, m_bManualRed);
	DDX_Control(pDX, IDB_MANUAL_OK_BZ, m_bManualOkBz);
	DDX_Control(pDX, IDB_MANUAL_LP_BLINK, m_bManualLampBlink);
	DDX_Control(pDX, IDB_MANUAL_GEN, m_bManualGen);
	DDX_Control(pDX, IDB_MANUAL_ER_BZ, m_bManualErrorBz);
	DDX_Control(pDX, IDB_MANUAL, m_bManual);
	DDX_Control(pDX, IDB_GEN, m_bGen);
	DDX_Control(pDX, IDB_ERROR_YEL, m_bErrorYel);
	DDX_Control(pDX, IDB_ERROR_RED, m_bErrorRed);
	DDX_Control(pDX, IDB_ERROR_OK_BZ, m_bErrorOKBz);
	DDX_Control(pDX, IDB_ERROR_LP_BLINK, m_bErrorLampBlink);
	DDX_Control(pDX, IDB_ERROR_GEN, m_bErrorGen);
	DDX_Control(pDX, IDB_ERROR_ER_BZ, m_bErrorERBz);
	DDX_Control(pDX, IDB_ERROR, m_bError);
	DDX_Control(pDX, IDB_COMPLETE, m_bCompl);
	DDX_Control(pDX, IDB_COMPL_YEL, m_bComplYel);
	DDX_Control(pDX, IDB_COMPL_RED, m_bComplRed);
	DDX_Control(pDX, IDB_COMPL_OK_BZ, m_bComplOKBz);
	DDX_Control(pDX, IDB_COMPL_LP_BLINK, m_bComplLampBlink);
	DDX_Control(pDX, IDB_COMPL_GEN, m_bComplGen);
	DDX_Control(pDX, IDB_COMPL_ER_BZ, m_bComplErrorBz);
	DDX_Control(pDX, IDB_CANCEL, m_bExit);
	DDX_Control(pDX, IDB_BZ_OK, m_bOkBz);
	DDX_Control(pDX, IDB_BZ_ER, m_bErrorBz);
	DDX_Control(pDX, IDB_BLANK, m_bBlink);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSettingTowerLamp, CDialog)
	//{{AFX_MSG_MAP(CSettingTowerLamp)
	ON_BN_CLICKED(IDB_MANUAL_GEN, OnManualGen)
	ON_BN_CLICKED(IDB_MANUAL_YEL, OnManualYel)
	ON_BN_CLICKED(IDB_MANUAL_RED, OnManualRed)
	ON_BN_CLICKED(IDB_MANUAL_ER_BZ, OnManualErBz)
	ON_BN_CLICKED(IDB_MANUAL_OK_BZ, OnManualOkBz)
	ON_BN_CLICKED(IDB_MANUAL_LP_BLINK, OnManualLpBlink)
	ON_BN_CLICKED(IDB_RUN_GNE, OnRunGne)
	ON_BN_CLICKED(IDB_RUN_YEL, OnRunYel)
	ON_BN_CLICKED(IDB_RUN_RED, OnRunRed)
	ON_BN_CLICKED(IDB_RUN_ER_BZ, OnRunErBz)
	ON_BN_CLICKED(IDB_RUN_OK_BZ, OnRunOkBz)
	ON_BN_CLICKED(IDB_RUN_LP_BLINK, OnRunLpBlink)
	ON_BN_CLICKED(IDB_ERROR_GEN, OnErrorGen)
	ON_BN_CLICKED(IDB_ERROR_YEL, OnErrorYel)
	ON_BN_CLICKED(IDB_ERROR_RED, OnErrorRed)
	ON_BN_CLICKED(IDB_ERROR_ER_BZ, OnErrorErBz)
	ON_BN_CLICKED(IDB_ERROR_OK_BZ, OnErrorOkBz)
	ON_BN_CLICKED(IDB_ERROR_LP_BLINK, OnErrorLpBlink)
	ON_BN_CLICKED(IDB_COMPL_GEN, OnComplGen)
	ON_BN_CLICKED(IDB_COMPL_YEL, OnComplYel)
	ON_BN_CLICKED(IDB_COMPL_RED, OnComplRed)
	ON_BN_CLICKED(IDB_COMPL_ER_BZ, OnComplErBz)
	ON_BN_CLICKED(IDB_COMPL_OK_BZ, OnComplOkBz)
	ON_BN_CLICKED(IDB_COMPL_LP_BLINK, OnComplLpBlink)
	ON_BN_CLICKED(IDB_SAVE, OnSave)
	ON_WM_TIMER()
	ON_BN_CLICKED(IDB_CANCEL, OnCancel)
	ON_WM_DESTROY()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSettingTowerLamp message handlers

void CSettingTowerLamp::OnManualGen() 
{
	// TODO: Add your control notification handler code here
	if (m_lnkTowerLampData->GetManualGen())
	{
		m_lnkTowerLampData->SetManualGen(FALSE);
	}
	else
	{
		m_lnkTowerLampData->SetManualGen(TRUE);
	}
	StartInitFlag = FALSE;
}

void CSettingTowerLamp::OnManualYel() 
{
	// TODO: Add your control notification handler code here
	if (m_lnkTowerLampData->GetManualYel())
	{
		m_lnkTowerLampData->SetManualYel(FALSE);
	}
	else
	{
		m_lnkTowerLampData->SetManualYel(TRUE);
	}
	StartInitFlag = FALSE;
}

void CSettingTowerLamp::OnManualRed() 
{
	// TODO: Add your control notification handler code here
	if (m_lnkTowerLampData->GetManualRed())
	{
		m_lnkTowerLampData->SetManualRed(FALSE);
	}
	else
	{
		m_lnkTowerLampData->SetManualRed(TRUE);
	}
	StartInitFlag = FALSE;
}

void CSettingTowerLamp::OnManualErBz() 
{
	// TODO: Add your control notification handler code here
	if (m_lnkTowerLampData->GetManualErrorBz())
	{
		m_lnkTowerLampData->SetManualErrorBz(FALSE);
	}
	else
	{
		m_lnkTowerLampData->SetManualErrorBz(TRUE);
	}
	StartInitFlag = FALSE;
}

void CSettingTowerLamp::OnManualOkBz() 
{
	// TODO: Add your control notification handler code here
	if (m_lnkTowerLampData->GetManualOkBz())
	{
		m_lnkTowerLampData->SetManualOkBz(FALSE);
	}
	else
	{
		m_lnkTowerLampData->SetManualOkBz(TRUE);
	}
	StartInitFlag = FALSE;
}

void CSettingTowerLamp::OnManualLpBlink() 
{
	// TODO: Add your control notification handler code here
	if (m_lnkTowerLampData->GetManualLampBlink())
	{
		m_lnkTowerLampData->SetManualLampBlink(FALSE);
	}
	else
	{
		m_lnkTowerLampData->SetManualLampBlink(TRUE);
	}
	StartInitFlag = FALSE;
}

void CSettingTowerLamp::OnRunGne() 
{
	// TODO: Add your control notification handler code here
	if (m_lnkTowerLampData->GetRunGen())
	{
		m_lnkTowerLampData->SetRunGen(FALSE);
	}
	else
	{
		m_lnkTowerLampData->SetRunGen(TRUE);
	}
	StartInitFlag = FALSE;
}

void CSettingTowerLamp::OnRunYel() 
{
	// TODO: Add your control notification handler code here
	if (m_lnkTowerLampData->GetRunYel())
	{
		m_lnkTowerLampData->SetRunYel(FALSE);
	}
	else
	{
		m_lnkTowerLampData->SetRunYel(TRUE);
	}
	StartInitFlag = FALSE;
}

void CSettingTowerLamp::OnRunRed() 
{
	// TODO: Add your control notification handler code here
	if (m_lnkTowerLampData->GetRunRed())
	{
		m_lnkTowerLampData->SetRunRed(FALSE);
	}
	else
	{
		m_lnkTowerLampData->SetRunRed(TRUE);
	}
	StartInitFlag = FALSE;
}

void CSettingTowerLamp::OnRunErBz() 
{
	// TODO: Add your control notification handler code here
	if (m_lnkTowerLampData->GetRunErrorBz())
	{
		m_lnkTowerLampData->SetRunErrorBz(FALSE);
	}
	else
	{
		m_lnkTowerLampData->SetRunErrorBz(TRUE);
	}
	StartInitFlag = FALSE;
}

void CSettingTowerLamp::OnRunOkBz() 
{
	// TODO: Add your control notification handler code here
	if (m_lnkTowerLampData->GetRunOkBz())
	{
		m_lnkTowerLampData->SetRunOkBz(FALSE);
	}
	else
	{
		m_lnkTowerLampData->SetRunOkBz(TRUE);
	}
	StartInitFlag = FALSE;

}

void CSettingTowerLamp::OnRunLpBlink() 
{
	// TODO: Add your control notification handler code here
	if (m_lnkTowerLampData->GetRunLampBlink())
	{
		m_lnkTowerLampData->SetRunLampBlink(FALSE);
	}
	else
	{
		m_lnkTowerLampData->SetRunLampBlink(TRUE);
	}
	StartInitFlag = FALSE;
}

void CSettingTowerLamp::OnErrorGen() 
{
	// TODO: Add your control notification handler code here
	if (m_lnkTowerLampData->GetErrorGen())
	{
		m_lnkTowerLampData->SetErrorGen(FALSE);
	}
	else
	{
		m_lnkTowerLampData->SetErrorGen(TRUE);
	}
	StartInitFlag = FALSE;
}

void CSettingTowerLamp::OnErrorYel() 
{
	// TODO: Add your control notification handler code here
	if (m_lnkTowerLampData->GetErrorYel())
	{
		m_lnkTowerLampData->SetErrorYel(FALSE);
	}
	else
	{
		m_lnkTowerLampData->SetErrorYel(TRUE);
	}
	StartInitFlag = FALSE;
}

void CSettingTowerLamp::OnErrorRed() 
{
	// TODO: Add your control notification handler code here
	if (m_lnkTowerLampData->GetErrorRed())
	{
		m_lnkTowerLampData->SetErrorRed(FALSE);
	}
	else
	{
		m_lnkTowerLampData->SetErrorRed(TRUE);
	}
	StartInitFlag = FALSE;
}

void CSettingTowerLamp::OnErrorErBz() 
{
	// TODO: Add your control notification handler code here
	if (m_lnkTowerLampData->GetErrorErrorBz())
	{
		m_lnkTowerLampData->SetErrorErrorBz(FALSE);
	}
	else
	{
		m_lnkTowerLampData->SetErrorErrorBz(TRUE);
	}
	StartInitFlag = FALSE;
}

void CSettingTowerLamp::OnErrorOkBz() 
{
	// TODO: Add your control notification handler code here
	if (m_lnkTowerLampData->GetErrorOkBz())
	{
		m_lnkTowerLampData->SetErrorOkBz(FALSE);
	}
	else
	{
		m_lnkTowerLampData->SetErrorOkBz(TRUE);
	}
	StartInitFlag = FALSE;
}

void CSettingTowerLamp::OnErrorLpBlink() 
{
	// TODO: Add your control notification handler code here
	if (m_lnkTowerLampData->GetErrorLampBlink())
	{
		m_lnkTowerLampData->SetErrorLampBlink(FALSE);
	}
	else
	{
		m_lnkTowerLampData->SetErrorLampBlink(TRUE);
	}
	StartInitFlag = FALSE;
}

void CSettingTowerLamp::OnComplGen() 
{
	// TODO: Add your control notification handler code here
	if (m_lnkTowerLampData->GetCompletGen())
	{
		m_lnkTowerLampData->SetCompletGen(FALSE);
	}
	else
	{
		m_lnkTowerLampData->SetCompletGen(TRUE);
	}
	StartInitFlag = FALSE;
}

void CSettingTowerLamp::OnComplYel() 
{
	// TODO: Add your control notification handler code here
	if (m_lnkTowerLampData->GetCompletYel())
	{
		m_lnkTowerLampData->SetCompletYel(FALSE);
	}
	else
	{
		m_lnkTowerLampData->SetCompletYel(TRUE);
	}
	StartInitFlag = FALSE;
}

void CSettingTowerLamp::OnComplRed() 
{
	// TODO: Add your control notification handler code here
	if (m_lnkTowerLampData->GetCompletRed())
	{
		m_lnkTowerLampData->SetCompletRed(FALSE);
	}
	else
	{
		m_lnkTowerLampData->SetCompletRed(TRUE);
	}
	StartInitFlag = FALSE;
}

void CSettingTowerLamp::OnComplErBz() 
{
	// TODO: Add your control notification handler code here
	if (m_lnkTowerLampData->GetCompletErrorBz())
	{
		m_lnkTowerLampData->SetCompletErrorBz(FALSE);
	}
	else
	{
		m_lnkTowerLampData->SetCompletErrorBz(TRUE);
	}
	StartInitFlag = FALSE;
}

void CSettingTowerLamp::OnComplOkBz() 
{
	// TODO: Add your control notification handler code here
	if (m_lnkTowerLampData->GetCompletOkBz())
	{
		m_lnkTowerLampData->SetCompletOkBz(FALSE);
	}
	else
	{
		m_lnkTowerLampData->SetCompletOkBz(TRUE);
	}
	StartInitFlag = FALSE;
}

void CSettingTowerLamp::OnComplLpBlink() 
{
	// TODO: Add your control notification handler code here
	if (m_lnkTowerLampData->GetCompletLampBlink())
	{
		m_lnkTowerLampData->SetCompletLampBlink(FALSE);
	}
	else
	{
		m_lnkTowerLampData->SetCompletLampBlink(TRUE);
	}
	StartInitFlag = FALSE;
}

void CSettingTowerLamp::OnSave() 
{
	// TODO: Add your control notification handler code here
	m_lnkTowerLampData->WriteTowerLampData();
}

void CSettingTowerLamp::OnCancel() 
{
	// TODO: Add your control notification handler code here
	m_lnkTowerLampData->ReadTowerLampData();
	CDialog::OnCancel();
}

BOOL CSettingTowerLamp::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	ButtonInitial();
	
	m_TimerID = SetTimer(12,100,NULL);
	if( !m_TimerID )
	{
		MyMessageBox("Timer has not been created.","Windows Error", M_ICONERROR);
		m_TimerInitFlag = FALSE;
	}
	else m_TimerInitFlag = TRUE;
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CSettingTowerLamp::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	ButtonUpdate();
	CDialog::OnTimer(nIDEvent);
}

void CSettingTowerLamp::OnDestroy() 
{
	CDialog::OnDestroy();
	
	// TODO: Add your message handler code here
	if(m_TimerInitFlag)
		KillTimer(m_TimerID);
}
void CSettingTowerLamp::ButtonInitial()
{
	m_bGen.SetImageOffset(1);
	m_bGen.SetTextOffset(4);
	m_bYel.SetImageOffset(1);
	m_bYel.SetTextOffset(4);
	m_bRed.SetImageOffset(1);
	m_bRed.SetTextOffset(4);
	m_bOkBz.SetImageOffset(1);
	m_bOkBz.SetTextOffset(4);
	m_bErrorBz.SetImageOffset(1);
	m_bErrorBz.SetTextOffset(4);
	m_bBlink.SetImageOffset(1);
	m_bBlink.SetTextOffset(4);

	m_bManualGen.SetImageOffset(1);
	m_bManualGen.SetTextOffset(4);

	m_bManualYel.SetImageOffset(1);
	m_bManualYel.SetTextOffset(4);

	m_bManualRed.SetImageOffset(1);
	m_bManualRed.SetTextOffset(4);

	m_bManualErrorBz.SetImageOffset(1);
	m_bManualErrorBz.SetTextOffset(4);

	m_bManualOkBz.SetImageOffset(1);
	m_bManualOkBz.SetTextOffset(4);

	m_bManualLampBlink.SetImageOffset(1);
	m_bManualLampBlink.SetTextOffset(4);
	
	m_bRunGen.SetImageOffset(1);
	m_bRunGen.SetTextOffset(4);

	m_bRunYel.SetImageOffset(1);
	m_bRunYel.SetTextOffset(4);
	m_bRunRed.SetImageOffset(1);
	m_bRunRed.SetTextOffset(4);
	m_bRunErrorBz.SetImageOffset(1);
	m_bRunErrorBz.SetTextOffset(4);
	m_bRunOkBz.SetImageOffset(1);
	m_bRunOkBz.SetTextOffset(4);
	m_bRunLampBlink.SetImageOffset(1);
	m_bRunLampBlink.SetTextOffset(4);

	m_bErrorGen.SetImageOffset(1);
	m_bErrorGen.SetTextOffset(4);
	m_bErrorYel.SetImageOffset(1);
	m_bErrorYel.SetTextOffset(4);
	m_bErrorRed.SetImageOffset(1);
	m_bErrorRed.SetTextOffset(4);
	m_bErrorERBz.SetImageOffset(1);
	m_bErrorERBz.SetTextOffset(4);
	m_bErrorOKBz.SetImageOffset(1);
	m_bErrorOKBz.SetTextOffset(4);
	m_bErrorLampBlink.SetImageOffset(1);
	m_bErrorLampBlink.SetTextOffset(4);

	m_bComplGen.SetImageOffset(1);
	m_bComplGen.SetTextOffset(4);
	m_bComplYel.SetImageOffset(1);
	m_bComplYel.SetTextOffset(4);
	m_bComplRed.SetImageOffset(1);
	m_bComplRed.SetTextOffset(4);
	m_bComplErrorBz.SetImageOffset(1);
	m_bComplErrorBz.SetTextOffset(4);
	m_bComplOKBz.SetImageOffset(1);
	m_bComplOKBz.SetTextOffset(4);
	m_bComplLampBlink.SetImageOffset(1);
	m_bComplLampBlink.SetTextOffset(4);


	m_bExit.SetColorTab(RGB(0,0,125));
	m_bExit.SetIcon(IDI_EXIT,30,30);
	m_bExit.SetImagePos(CPoint(MINBUTTON_CENTER,5));
	m_bExit.SetTextPos(CPoint(MINBUTTON_CENTER,40));
	m_bExit.SetTextSize(10);

	m_bSave.SetIcon(IDI_SAVE, 32, 32);
	m_bSave.SetImagePos(CPoint(MINBUTTON_CENTER, 2));
	m_bSave.SetTextPos(CPoint(MINBUTTON_CENTER, 34));
	m_bSave.SetTextSize(10, TRUE);
}
void CSettingTowerLamp::ButtonUpdate()
{
	if (!StartInitFlag)
	{
		if (m_lnkTowerLampData->GetManualGen())
		{
			m_bManualGen.SetColor(GREEN);
		}
		else
		{
			m_bManualGen.SetColor(WHITE);
		}
		
		if (m_lnkTowerLampData->GetManualYel())
		{
			m_bManualYel.SetColor(YELLOW);
		}
		else
		{
			m_bManualYel.SetColor(WHITE);
		}
		if (m_lnkTowerLampData->GetManualRed())
		{
			m_bManualRed.SetColor(RED);
		}
		else
		{
			m_bManualRed.SetColor(WHITE);
		}
		
		if (m_lnkTowerLampData->GetManualErrorBz())
		{
			m_bManualErrorBz.SetIcon(IDI_CHECK, 32,32);
			m_bManualErrorBz.SetColor(WHITE);
		}
		else
		{
			m_bManualErrorBz.SetIcon(0,32,32);
			m_bManualErrorBz.SetColor(WHITE);
		}
		if (m_lnkTowerLampData->GetManualOkBz())
		{
			m_bManualOkBz.SetIcon(IDI_CHECK, 32,32);
			m_bManualOkBz.SetColor(WHITE);
		}
		else
		{
			m_bManualOkBz.SetIcon(0,32,32);
			m_bManualOkBz.SetColor(WHITE);
		}
		if (m_lnkTowerLampData->GetManualLampBlink())
		{
			m_bManualLampBlink.SetIcon(IDI_CHECK, 32,32);
			m_bManualLampBlink.SetColor(WHITE);
		}
		else
		{
			m_bManualLampBlink.SetIcon(0,32,32);
			m_bManualLampBlink.SetColor(WHITE);
		}
		
		if (m_lnkTowerLampData->GetRunGen())
		{
			m_bRunGen.SetColor(GREEN);
		}
		else
		{
			m_bRunGen.SetColor(WHITE);
		}
		
		if (m_lnkTowerLampData->GetRunYel())
		{
			m_bRunYel.SetColor(YELLOW);
		}
		else
		{
			m_bRunYel.SetColor(WHITE);
		}
		if (m_lnkTowerLampData->GetRunRed())
		{
			m_bRunRed.SetColor(RED);
		}
		else
		{
			m_bRunRed.SetColor(WHITE);
		}
		
		if (m_lnkTowerLampData->GetRunErrorBz())
		{
			m_bRunErrorBz.SetIcon(IDI_CHECK, 32,32);
			m_bRunErrorBz.SetColor(WHITE);
		}
		else
		{
			m_bRunErrorBz.SetIcon(0,32,32);
			m_bRunErrorBz.SetColor(WHITE);
		}
		if (m_lnkTowerLampData->GetRunOkBz())
		{
			m_bRunOkBz.SetIcon(IDI_CHECK, 32,32);
			m_bRunOkBz.SetColor(WHITE);
		}
		else
		{
			m_bRunOkBz.SetIcon(0,32,32);
			m_bRunOkBz.SetColor(WHITE);
		}
		if (m_lnkTowerLampData->GetRunLampBlink())
		{
			m_bRunLampBlink.SetIcon(IDI_CHECK, 32,32);
			m_bRunLampBlink.SetColor(WHITE);
		}
		else
		{
			m_bRunLampBlink.SetIcon(0,32,32);
			m_bRunLampBlink.SetColor(WHITE);
		}
		
		if (m_lnkTowerLampData->GetErrorGen())
		{
			m_bErrorGen.SetColor(GREEN);
		}
		else
		{
			m_bErrorGen.SetColor(WHITE);
		}
		
		if (m_lnkTowerLampData->GetErrorYel())
		{
			m_bErrorYel.SetColor(YELLOW);
		}
		else
		{
			m_bErrorYel.SetColor(WHITE);
		}
		if (m_lnkTowerLampData->GetErrorRed())
		{
			m_bErrorRed.SetColor(RED);
		}
		else
		{
			m_bErrorRed.SetColor(WHITE);
		}
		
		if (m_lnkTowerLampData->GetErrorErrorBz())
		{
			m_bErrorERBz.SetIcon(IDI_CHECK, 32,32);
			m_bErrorERBz.SetColor(WHITE);
		}
		else
		{
			m_bErrorERBz.SetIcon(0,32,32);
			m_bErrorERBz.SetColor(WHITE);
		}
		if (m_lnkTowerLampData->GetErrorOkBz())
		{
			m_bErrorOKBz.SetIcon(IDI_CHECK, 32,32);
			m_bErrorOKBz.SetColor(WHITE);
		}
		else
		{
			m_bErrorOKBz.SetIcon(0,32,32);
			m_bErrorOKBz.SetColor(WHITE);
		}
		if (m_lnkTowerLampData->GetErrorLampBlink())
		{
			m_bErrorLampBlink.SetIcon(IDI_CHECK, 32,32);
			m_bErrorLampBlink.SetColor(WHITE);
		}
		else
		{
			m_bErrorLampBlink.SetIcon(0,32,32);
			m_bErrorLampBlink.SetColor(WHITE);
		}
		
		if (m_lnkTowerLampData->GetCompletGen())
		{
			m_bComplGen.SetColor(GREEN);
		}
		else
		{
			m_bComplGen.SetColor(WHITE);
		}
		
		if (m_lnkTowerLampData->GetCompletYel())
		{
			m_bComplYel.SetColor(YELLOW);
		}
		else
		{
			m_bComplYel.SetColor(WHITE);
		}
		if (m_lnkTowerLampData->GetCompletRed())
		{
			m_bComplRed.SetColor(RED);
		}
		else
		{
			m_bComplRed.SetColor(WHITE);
		}
		
		if (m_lnkTowerLampData->GetCompletErrorBz())
		{
			m_bComplErrorBz.SetIcon(IDI_CHECK, 32,32);
			m_bComplErrorBz.SetColor(WHITE);
		}
		else
		{
			m_bComplErrorBz.SetIcon(0,32,32);
			m_bComplErrorBz.SetColor(WHITE);
		}
		if (m_lnkTowerLampData->GetCompletOkBz())
		{
			m_bComplOKBz.SetIcon(IDI_CHECK, 32,32);
			m_bComplOKBz.SetColor(WHITE);
		}
		else
		{
			m_bComplOKBz.SetIcon(0,32,32);
			m_bComplOKBz.SetColor(WHITE);
		}
		if (m_lnkTowerLampData->GetCompletLampBlink())
		{
			m_bComplLampBlink.SetIcon(IDI_CHECK, 32,32);
			m_bComplLampBlink.SetColor(WHITE);
		}
		else
		{
			m_bComplLampBlink.SetIcon(0,32,32);
			m_bComplLampBlink.SetColor(WHITE);
		}
	}

	StartInitFlag = TRUE;
}